<div class="row">
  <div data-hook="bill_address_wrapper" class="col-12 col-lg-6">
    <div class="card mb-3">
      <div class="card-header">
        <h1 class="card-title mb-0 h5">
          <%= Spree.t(:billing_address) %>
        </h1>
      </div>

      <div class="card-body">
        <%= f.fields_for :bill_address, (@user.bill_address || Spree::Address.default(@user, "bill")) do |ba_form| %>
          <% ba_form.object ||= Spree::Address.new(country: Spree::Country.new) %>
          <%= render partial: 'spree/admin/shared/address_form', locals: { f: ba_form, type: "billing" } %>
        <% end %>
      </div>
    </div>
  </div>

  <div data-hook="ship_address_wrapper" class="col-12 col-lg-6">
    <div class="card mb-3">
      <div class="card-header">
        <h1 class="card-title mb-0 h5">
          <%= Spree.t(:shipping_address) %>
        </h1>
      </div>

      <div class="card-body">
          <p class="form-group" data-hook="use_billing">
            <% checked = @user.bill_address.nil? ? false : @user.bill_address == @user.ship_address %>
            <%= check_box_tag 'user[use_billing]', '1', checked, class: 'checkbox' %>
            <%= label_tag :use_billing, Spree.t(:use_billing_address), for: 'user_use_billing', id: 'use_billing', class: 'form-check-label' %>
          </p>
        <%= f.fields_for :ship_address, (@user.ship_address || Spree::Address.default(@user, "ship")) do |sa_form| %>
          <% sa_form.object ||= Spree::Address.new(country: Spree::Country.new) %>
          <%= render partial: 'spree/admin/shared/address_form', locals: { f: sa_form, type: "shipping" } %>
        <% end %>
      </div>
    </div>
  </div>
</div>
